namespace instamuz.DataAccess.Queries.AccountQueries
{
    using System.Linq;
    using Domain.Entities;
    using IndyCode.Infrastructure.Domain;
    using IndyCode.Infrastructure.NHibernate;
    using instamuz.Application.Criterias;

    public class FindAccountByIdQuery : LinqQueryBase<Account, FindByIdCriteria, Account>
    {
        public FindAccountByIdQuery(ILinqProvider linq)
            : base(linq)
        {
        }

        public override Account Ask(FindByIdCriteria criterion)
        {
            return Query
                .SingleOrDefault(x => x.Id == criterion.Id);
        }
    }
}